home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6532 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: qualcomm.com!usenet
  2. From: nabbasi@qualcomm.com (Nasser Abbasi)
  3. Newsgroups: comp.lang.c++,comp.unix.programmer
  4. Subject: Re: c++ static objects and fork
  5. Date: 9 Feb 1996 06:00:56 GMT
  6. Organization: QUALCOMM
  7. Message-ID: <4fenuo$fg0@qualcomm.com>
  8. References: <4e8qu5$cmb@news02.comp.pge.com>
  9. NNTP-Posting-Host: nabbasi.qualcomm.com
  10. Mime-Version: 1.0
  11. X-Newsreader: WinVN 0.93.14
  12.  
  13. In article <4e8qu5$cmb@news02.comp.pge.com>, psk3@pge.com says...
  14. >
  15. >Here's a simple question, hopefully with a simple answer:  
  16. >
  17. >        I have a program which turns itself into a daemon using fork 
  18. (etc.), 
  19. >but I also have several static objects within the program.  What happens 
  20. to 
  21. >these objects after the fork?  There is no exec, so they dont get 
  22. created anew, 
  23. >at least I guess this is the case...
  24. >        Anyone have this figured out?  BTW, system is HPUX v 9.04.
  25. >
  26.  
  27. Well, not sure what you are asking, let me ramble for little, may I say
  28. something of use to you...
  29.  
  30. when a process forks, an excat copy of the process address space of the 
  31. parent get created for the forked process. so it seems to me that at the 
  32. instant the fork is completed, the child and the parent processes will 
  33. have access to the objects. Now a daemon I think is a process that has
  34. no parent (poor process) i.e. Parent id of 1, but it will still have its 
  35. own copy of the objects.. so things should work ok..
  36.  
  37. I am not sure if I am answering your question really.
  38.  
  39. Nasser
  40.  
  41. the parent
  42.  
  43.